#import "Frame.h"
#import <vector.h>
#import "ActionTools.h"

class Action {
	
public:
	
	Action();
	
	Action(const Action& rA);
	
	~Action();
	
private:
	byte m_FrameNum;
	
    vector<Frame*> m_myFrame ;
	
	//int frameIndex;
	long time;
	
	bool bFirst;
	
	bool bFlash;
	
public:
	
	int drawAction(int frameIndex, int x, int y, int type, int frameID, int off,int changeTime,int m_RoleType,CCTexture* img);
	
	void resetAction();
	
	void loadFrame(FILE* fp);
	
	vector<Frame*> & GetActionFrame();
	
public:
	
	double frameTime;
	
	bool m_bActionFinish;
	
	bool update(double time, int& frameIndex) {
		/*
		frameTime += time;
		//printf("%f", frameTime);
		cout << "frameIndex:" << frameIndex << endl;
		cout << "当前本帧已播放时间frameTime:" << frameTime*1000 << endl;
		cout << "本帧总需时间:" << m_myFrame[frameIndex]->m_iTime << endl;
		cout << "本动画有多少帧:" << (int)m_FrameNum << endl;
		if( frameTime*1000 > m_myFrame[frameIndex]->m_iTime ){
			
			printf("%f", frameTime);
			
			frameTime = 0;
			frameIndex++;
			if( frameIndex >= m_FrameNum ){
				frameIndex = 0;
				return true;
			}else
				return false;
		}
		return false;
		 */
		return true;
	}
	
	bool isActionFinish(){
		return m_bActionFinish;
	};
	
};